package core.fuzzy;

import java.util.ArrayList;
import java.util.List;

import cure.fuzzy.util.TermInterface;

public class FuzzyVar {
	private List<TermInterface> terms;
	
	public FuzzyVar() {
		this.terms = new ArrayList<TermInterface>();
	}
	
	public void addTerm(TermInterface term) {
		terms.add(term);
	}
	
	public void deleteTerm(TermInterface term) {
		terms.remove(term);
	}
	
	public double MF(double x) {
		double res = 0;
		String name = "";
		
		for (TermInterface term : terms)
			if (term.MF(x) > res) {
				res = term.MF(x);
				name = term.getName();
			}
		
		System.out.println("Checked x = " + x + " at " + name + ", result " + res);
		
		return res;
	}
}